Skip to content

fix: NetworkVariable subclasses not generating serialization code#2421

Merged
ShadauxCat merged 3 commits intodevelopfrom
fix/networkvariable_subclasses_throwing_errors
Mar 9, 2023
Merged

fix: NetworkVariable subclasses not generating serialization code#2421
ShadauxCat merged 3 commits intodevelopfrom
fix/networkvariable_subclasses_throwing_errors

Conversation

@ShadauxCat
Copy link
Copy Markdown
Collaborator

@ShadauxCat ShadauxCat commented Feb 22, 2023

ILPP didn't know how to identify subclasses when looking for the list of wrapped types to generate serialization code for.

fixes #2385

MTT-5503

Changelog

  • Fixed: Fixed subclasses of NetworkVariable failing to generate serialization code unless a normal NetworkVariable of the same wrapped type existed somewhere else in the code.

Testing and Documentation

  • Includes unit tests.
  • No documentation changes or additions were necessary.

@ShadauxCat ShadauxCat requested a review from a team as a code owner February 22, 2023 21:42
{
var genericType = (GenericInstanceType)baseType;
var newGenericType = new GenericInstanceType(baseType.Resolve());
for (var i = 0; i < genericType.GenericArguments.Count; ++i)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a question than a comment on the code :). Is there a reason you're not using foreach apart from this is your preferred way to iterate? I'm just wondering if there are reasons not to use it which I'm not aware of?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

um... if you look at the code below, in the next loop, it's accessing two different arrays with the same index. I think when I originally wrote this loop, it was doing the same thing, so I was using C-style for to be able to have access to the index value for the other array. At some point I think I realized this loop doesn't need it and removed the other access, but didn't change the loop style.

Copy link
Copy Markdown
Member

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ShadauxCat ShadauxCat enabled auto-merge (squash) March 3, 2023 18:07
@ShadauxCat ShadauxCat disabled auto-merge March 3, 2023 19:00
@ShadauxCat ShadauxCat enabled auto-merge (squash) March 9, 2023 21:09
@ShadauxCat ShadauxCat merged commit 0b29662 into develop Mar 9, 2023
@ShadauxCat ShadauxCat deleted the fix/networkvariable_subclasses_throwing_errors branch March 9, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting any NetworkVariable after upgrading from 1.0.2 to 1.1.0 throws a NullReferenceException

3 participants